{% extends 'AdminsBundle:base:main.content.lists.div.html.twig' %}
{% block options %}
    <div class="menu-list">
        <div class="rule-single-select">
            <select name="cond[type]" onchange="javascript:__doPostBack('searchCond','')" >
                <option value="" {{app.request.get("cond").type is defined and app.request.get("cond").type == "" ? ' selected="selected"' : "" }} >请选择活动类型</option>
                <option value="1" {{app.request.get("cond").type is defined and app.request.get("cond").type == "1" ? ' selected="selected"' : "" }} >品牌活动</option>
                <option value="2" {{app.request.get("cond").type is defined and app.request.get("cond").type == "2" ? ' selected="selected"' : "" }} >礼品活动</option>
                <option value="3" {{app.request.get("cond").type is defined and app.request.get("cond").type == "3" ? ' selected="selected"' : "" }} >专题活动</option>
            </select>
        </div>
        <div class="rule-single-select">
            <select name="cond[status]" onchange="javascript:__doPostBack('searchCond','')" >
                <option value="" {{app.request.get("cond").status is defined and app.request.get("cond").status == "" ? ' selected="selected"' : "" }} >全部</option>
                <option value="0" {{app.request.get("cond").status is defined and app.request.get("cond").status == "0" ? ' selected="selected"' : "" }} >已结束</option>
                <option value="1" {{app.request.get("cond").status is defined and app.request.get("cond").status == "1" ? ' selected="selected"' : "" }} >进行中</option>
            </select>
        </div>
    </div>
{% endblock %}
{% block tableHead %}
    <tr>
        <th width="6%">选择</th>
        <th align="left">标题</th>
        <th align="left" width="10%">促销活动类型</th>
        <th align="center" width="25%">图片</th>
        <th align="left" width="10%">更新时间</th>
        <th align="center" width="10%">排序</th>
        <th align="center" width="8%">活动状态</th>
        <th align="center" width="5%">管理</th>
    </tr>
{% endblock %}
{% block tableList %}
    {% for Activity in lists %}
        <tr>
            <td align="center">
                <span class="checkall" style="vertical-align:middle;">
                    <input type="checkbox" name="ids[]" value="{{ Activity.id }}"/>
                </span>
            </td>
            <td align="left">{{ Activity.title }}</td>
            {% set arr = ["品牌促销","节日促销","专题促销"] %}
            <td align="left">{{ arr[Activity.type - 1] }}</td>
            <td align="center">
                <img src="{{ Activity.cover }}" alt="封面图片" width="200" />
            </td>
            <td align="left">{{ Activity.update | date("Y-m-d H:i:s") }}</td>
            <td align="center">
                <input id="val_{{ Activity.id }}" type="text" value="{{ Activity.orders }}"  class="sort" onkeydown="return checkNumber(event);" onblur="__doPostBack('setAttr','id={{ Activity.id }}&orders='+ $('#val_{{ Activity.id }}').val())">
            </td>
            <td align="center">
                <div class="btn-tools">
                    <a title="{{ Activity.status == 1 ? "取消" : "设置" }}启用" class="top {{ Activity.status == 1 ? "selected" : "" }}" href="javascript:__doPostBack('setAttr','id={{ Activity.id }}&status={{ Activity.status == 1 ? 0 : 1 }}')"></a>
                </div>
            </td>
            <td align="center">
                <a href="{{ path("ActivityPreEdit",{'id':Activity.id}) }}" class="img-btn edit"></a>
            </td>
        </tr>
    {% endfor %}
{% endblock %}
{% block script %}
    {#{% include 'AdminsBundle:base:inc.js.pic.upload.twig' %}#}
    {#{% include 'AdminsBundle:base:inc.js.article.twig' %}#}
    {#{% include 'AdminsBundle:base:inc.js.form.valid.twig' %}#}
    {#{% include 'AdminsBundle:base:inc.js.date.picker.twig' %}#}
{% endblock %}

